//-----------------------------------------------------------------------

// <copyright file="ILayoutStrategy.cs" company="Jamie Knight">

// Copyright (c) Jamie Knight. All rights reserved.

// </copyright>

//-----------------------------------------------------------------------

using DevKnightlie.WPF.AutoForm.FieldDefinitions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace DevKnightlie.WPF.AutoForm.Interfaces
{
    /// <summary>
    /// Describes a class which arranges input fields on behalf of an AutoFormPanel
    /// </summary>
    public interface ILayoutStrategy
    {

        #region Properties

        /// <summary>
        /// Holds a reference to the AutoFormPanel whose input fields are being laid out
        /// </summary>
        AutoFormPanel FormPanel { get; set; }


        #endregion


        #region Methods

        /// <summary>
        /// Called when the form needs to be laid out. Implementers should store the given dictionaries for use during the layout
        /// </summary>
        /// <param name="containerControls">Dictionary of input field controls against field definitions</param>
        /// <param name="fieldLabels">Dictionary of field label controls against field definitions</param>
        void Initialise(Dictionary<BaseFieldDefinition,Control> inputFields,
            Dictionary<BaseFieldDefinition,Control> fieldLabels);

        /// <summary>
        /// Called when the layout needs to be created
        /// </summary>
        void CreateLayout();


        /// <summary>
        /// Called when the AutoFormPanel needs to unload - the strategy should drop all refernces to all form controls
        /// </summary>
        void DropLayout();


        /// <summary>
        /// Called when the forms layout has changed in some way. Gives the strategy a chance to respond
        /// </summary>
        void LayoutChanged();


        #endregion

    }
}
